﻿#pragma once

#include "Const.h"
#include "Snake.h"
#include "SnakeBody.h"

// 游戏
class Game {
    // 状态
    public: enum Status {
        END,    // 已结束
        PAUSED, // 暂停中
        PLAYING // 游戏中
    };

    private: SnakeBody* mApple; // 果子
    private: CWnd* mCallback;   // 回调
    private: int mDifficulty;   // 难度
    private: CDC* mDrawer;      // 绘图者
    private: BOOL mEnableMusic; // 音乐开关
    private: CWnd* mGameBoard;  // 游戏区域
    private: int mScore;        // 得分
    private: Snake* mSnake;     // 蛇
    private: Status mStatus;    // 状态

    public: Game(CWnd*, CDC*, CWnd*);
    private: void CreateApple();
    private: void DrawGameBoard();
    private: void GameOver(BOOL);
    public: Status GetStatus();
    private: BOOL IsWon();
    public: void OnKeyPressed(UINT);
    public: void OnTimer();
    public: void Pause();
    public: BOOL PlayMusic();
    private: BOOL PointIsUsed(CPoint*);
    public: void Start();
};
